#include <iostream>
#include <list>

using namespace std;

int main()
{
    int i,A[]={15,36,7,17};
    list<int>::iterator It;
    list<int>L1,L2,L3(A,A+4);

    for(i=1;i<=6;i++) L1.push_back(i);
    for(i=1;i<=3;i++) L2.push_back(i*10);

    It=L1.begin();
    advance(It,2);
    L1.splice(It,L2);
    L2.splice(L2.begin(),L1,It);
    L1.remove(20);
    L1.sort();
    L1.merge(L3);
    L1.push_front(L2.front());
    L1.reverse();
    for(It=L1.begin();It!=L1.end();++It) cout<<*It<<"";
    
    return 0;
}